#include<stdio.h>
#include<stdlib.h>
typedef struct Node {
	struct Node* p;
	int key;
}node;
node* Init(node* array);
void Hash_table(node* array, int* a);
int main() {
	int a[10] = { 1,700,14,10,15,16,17,19,26,11 };
	node* array = NULL;
	array=Init(array);
	Hash_table(array, &a[0]);
	for (int i = 0; i < 10; i++) {
		if (array[i].p != NULL) {
			printf("%d\t", array[i].key);
			node* temp = array[i].p;
			while (temp != NULL) {
				printf("%d\t", temp->key);
				temp = temp->p;
			}printf("\n");
		}else {
			printf("%d\n", array[i].key);
		}
	}
}
node* Init(node* array)
{
	array = (node*)malloc(sizeof(node) * 10);
	for (int i = 0; i < 10; i++) {
		array[i].p = NULL;
		array[i].key = 0;
	}
	return array;
}
void Hash_table(node* array, int* a) {
	int b;
	for (int i = 0; i < 10; i++) {
		b = a[i] % 7;
		if (array[b].key == 0) {
			array[b].key = a[i];
		}
		else {
			node* temp = (node*)malloc(sizeof(node));
			temp->p = array[b].p;
			temp->key = a[i];
			array[b].p = temp;
		}
	}
}
